<?php
defined('_JEXEC') or die('Restricted access');

/**
 * Description of Watcher
 * @todo 
 * 
 * @author George Zeakis<zeageorge@google.com>
 * 
 */
class Watcher {
    
    protected static $_objectsToWatch = array();
    
    protected static $_instance;
 
    /**
     * we don't permit an explicit call of the constructor! (like $v = new Singleton()) 
     */
    protected function __construct(){}
 
    /**
     * we don't permit cloning the singleton (like $x = clone $v) 
     */
    protected function __clone(){}
 
    public static function getInstance(){
      if( self::$_instance === NULL ) { self::$_instance = new self(); }
      
      // scan folders, find and register the Actions...
      
      return self::$_instance;
    }
    
    /**
     * 
     * @param type $what What to watch
     * @param type $of   The object that $what belongs to
     */
    public static function start_watching(&$what, &$of=NULL){
        if( self::$_instance === NULL ) { self::getInstance(); }
        // should we use the tic function of php to watch the $what ?
        // check: http://php.net/manual/en/control-structures.declare.php
        //        http://www.php.net/manual/en/function.register-tick-function.php
        //        http://www.php.net/manual/en/function.unregister-tick-function.php
        //
        //
    }
    
    public static function stop_watching(&$what){
        if( self::$_instance === NULL ) { self::getInstance(); }
    }
    
    public static function act(){
        if( self::$_instance === NULL ) { self::getInstance(); }
    }
    
}

?>
